import { get } from 'lodash-es'

export class RoomHistory {
  id?: string
  hotel_id?: string
  openid?: string
  confirm_number?: string
  resv_name_id?: string
  primary_confirm_number?: string
  primary_resv_name_id?: string
  origin_room?: string
  room?: string
  business_date?: string
  created_at?: string
  updated_at?: string
  version?: number;
  [key: string]: any

  constructor(data?: RoomHistory) {
    this.init(data)
  }
}

RoomHistory.prototype.init = function init(data?: RoomHistory) {
  this.id = get(data, 'id')
  this.hotel_id = get(data, 'hotel_id')
  this.openid = get(data, 'openid')
  this.confirm_number = get(data, 'confirm_number')
  this.resv_name_id = get(data, 'resv_name_id')
  this.primary_confirm_number = get(data, 'primary_confirm_number')
  this.primary_resv_name_id = get(data, 'primary_resv_name_id')
  this.origin_room = get(data, 'origin_room')
  this.room = get(data, 'room')
  this.business_date = get(data, 'business_date')
  this.created_at = get(data, 'created_at')
  this.updated_at = get(data, 'updated_id')
  this.version = get(data, 'version')
}
